using System.Windows;
using System.Windows.Browser;

namespace PrismNavigationFramework.Infrastructure
{
    public class PrismNavigationFrameworkApplicationService : IApplicationService
    {
        public void StartService(ApplicationServiceContext context)
        {
            var navigationFrame = HtmlPage.Document.GetElementById("_sl_historyFrame");
            if (navigationFrame == null)
            {
                var navigationDiv = HtmlPage.Document.CreateElement("iframe");

                // Set the innerHTML property
                navigationDiv.SetProperty("id", "_sl_historyFrame");

                // Set some style properties
                navigationDiv.SetStyleAttribute("visibility", "hidden");
                navigationDiv.SetStyleAttribute("height", "0px");
                navigationDiv.SetStyleAttribute("width", "0px");
                navigationDiv.SetStyleAttribute("border", "0px");
                HtmlPage.Document.Body.AppendChild(navigationDiv);
            }
        }

        public void StopService()
        {
            
        }
    }
}